# -*- coding: utf-8 -*-
# Author: jurrabi <jurrabi@gmail.com>
# URL: http://code.google.com/p/mytvalacarta//
#
# This file is part of myTValacarta.
#
# myTValacarta is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# myTValacarta is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with myTValacarta.  If not, see <http://www.gnu.org/licenses/>.
# UTF Check: áéíóú
'''
Created on 21/08/2010

@author: jurrabi
'''


REMOTE_DBG = False
DEBUG_LEVEL = 0 # 0=DEBUG;1=WAR&ERRORS;2=ERRORS;3=NO_LOG

def info (text):
    print text

log = info
    
def debug (text):
    if DEBUG_LEVEL == 0:
        print text

def warning (text):
    if DEBUG_LEVEL <= 1:
        print text

def error (text):
    if DEBUG_LEVEL <= 2:
        print text

# Remote debugin from pydev
if REMOTE_DBG:
    # Make pydev debugger works for auto reload.
    # Note pydevd module need to be copied in XBMC\system\python\Lib\pysrc
    try:
        import pysrc.pydevd as pydevd
        # stdoutToServer and stderrToServer redirect stdout and stderr to eclipse console
        # El server está en el PC donde tengas ejecutando eclipse
        pydevd.settrace('localhost', stdoutToServer=True, stderrToServer=True)
        debug("[logger.py] REMOTE_DGB ON -  conected with server on localhost")
    except ImportError:
        error("[logger.py] REMOTE_DBG Error: " + \
                     "You must add org.python.pydev.debug.pysrc to your PYTHONPATH.")
        REMOTE_DBG = False 
